/*
Kane and Anson
"Deficit Attention Disorder"
Political Behavior

Replication Files For:  Pew Research Center and Voter Study Group Data

*/

*************************
*PEW RESEARCH CENTER DATA
*************************

use "Kane_Anson_PRC_AppendedData.dta", replace

/* Notes on Dependent Variable Codings

Binary version of DV (top priority vs. not)
gen deficitreduce_topP=1 if deficit_priority==1
replace deficitreduce_topP=0 if deficit_priority!=1 & deficit_priority!=.
 
 
*Ordered version of DV
codebook deficit_priority
recode deficit_priority (4=1) (3=2) (9=3) (2=4) (1=5), gen(deficit_priority_5pt)
*/


*FIGURE 5 (Top Panel)
logit deficitreduce_topP i.D0I1R2##i.RepublicanAdmin ///
age1 income1 i.raceID Female education libcon_clean ///
if age1!=-99 & education!=-99 & income1!=-99 
margins, dydx(RepublicanAdmin) at(D0I1R2=(0(1)2)) // estimated effects/p-values for each partisan group

marginsplot, scheme(plotplain) recast(scatter) legend(ring(0) pos(1)) ///
title("") ///
ytitle("Effect of Trump Administration on" "Pr(Prioritize Deficit Reduction)") ///
xtitle("") ///
xsize(6.5) ysize(4) graphregion(margin(medium)) 
*Ensure that working directory is set to correct folder
graph play Fig5_edits // uses .grec file
 
 
*SUPPLEMENTAL APPENDIX

*TABLE E1 ("Binomial Model" column)
logit deficitreduce_topP i.D0I1R2##i.RepublicanAdmin ///
age1 income1 i.raceID Female education libcon_clean ///
if age1!=-99 & education!=-99 & income1!=-99 

margins, dydx(RepublicanAdmin) at(D0I1R2=(0(1)2)) // estimated effects/p-values for each partisan group (cited in text)
 
 
*TABLE E1 ("Ordered Model" column)
ologit deficit_priority_5pt i.D0I1R2##i.RepublicanAdmin ///
age1 income1 i.raceID Female education libcon_clean ///
if age1!=-99 & education!=-99 & income1!=-99 




***********************************
*VOTER STUDY GROUP (VSG) PANEL DATA
***********************************

use "Kane_Anson_VSG_ReshapedData.dta", replace

/*Data for the January 2019 Voter Study Group Panel can be downloaded here:

https://www.voterstudygroup.org/data

Note:  The data included in this replication file data reshaped to long-form, 
with up to three observations per respondent in the panel (2016, 2017, and 2019).
*/

*FIGURE 5 (Bottom Panel)
logit deficitVimportant i.D0I1R2_2016##i.wave if wave>=16, vce(cluster caseid2)
margins, dydx(wave) at(D0I1R2_2016=(0(1)2)) 

marginsplot, recast(scatter) scheme(plotplain) legend(ring(0) pos(1)) ///
yline(0) ///
graphregion(margin(-2 7 1 1)) ///
ysize(3.7) xsize(6.5) ///
title("") ytitle("Effect of Trump Administration" "on Pr(Prioritize Deficit Reduction)", size(medsmall)) ///
plotopts(mcolor(black)) ciopts(color(black)) ///
xtitle("") 
*Note: Minor edits were manually made to the graph for aesthetic purposes


*Examining levels of deficit importance across parties (cited in text)
*Democrats vs. Republicans in baseline year (2016)
proportion deficitVimportant if D0I1R2_2016==0 & wave==16 // Democrats in 2016
proportion deficitVimportant if D0I1R2_2016==2 & wave==16 // Republicans in 2016

*Democrats vs. Republicans in third wave (2019)
proportion deficitVimportant if D0I1R2_2016==0 & wave==19 // Democrats in 2019
proportion deficitVimportant if D0I1R2_2016==2 & wave==19 // Republicans in 2019



*SUPPLEMENTAL APPENDIX

*TABLE E1 ("Binomial Model" column)
logit deficitVimportant i.D0I1R2_2016##i.wave if wave>=16, vce(cluster caseid2)

*TABLE E1 ("Ordered Model" column)
ologit revdeficitimportance i.D0I1R2_2016##i.wave if wave>=16, vce(cluster caseid2)


